class Solution:

    def __init__(self):
        self.num_least = dict()  # 记忆化搜索

    def least(self, num) -> int:
        if num < 10:
            return 0

        if num in self.num_least:
            return self.num_least[num]
        # not in
        num = str(num)
        num_tmp = int(num[0])
        for i in range(1, len(num)):
            num_tmp *= int(num[i])
        return self.least(num_tmp) + 1

    def ans_func(self, a: int, b: int):
        ans = []
        flag = 0
        for i in range(a, b + 1):
            self.num_least[i] = self.least(i)

            if flag < self.num_least[i]:
                ans.clear()
                flag = self.num_least[i]

            if flag == self.num_least[i]:
                ans.append(i)

        return (flag, ans)


if __name__ == "__main__":
    temp = input().split(" ")
    a = int(temp[0])
    b = int(temp[1])
    solu = Solution()

    ans = solu.ans_func(a, b)
    print(ans[0])
    for i in range(len(ans[1])):
        if i:
            print(end=" ")
        print(ans[1][i], end="")
